/*! \file   converter.h
	\author HiddenSeeker

	Determines a conversion node
*/
#include "classtype.h"
#include "list.h"
#include "../../semantics/parentdata.h"
#pragma once
enum ConverterType
{
	CT_PROCEDURE,
	CT_QUERY
};
/*! Declares a converter type
*/
class ConverterNode: public AbstractNode
{
 private:
	     std::string *             m_featurename;
		 ListNode<ClassTypeNode> * m_parameters;
		 ConverterType             m_type;
	 void createProcedure(ParentData * parent);
	 void createQuery(ParentData * parent);
 public:
	 inline const std::string & featureName()            { return *m_featurename;}
	 inline ListNode<ClassTypeNode> * params()    { return m_parameters;  }
	 inline ConverterType type()                  { return m_type;}
	 inline ConverterNode(const YYLTYPE & pos, std::string * name, 
	                   	 ListNode<ClassTypeNode> * params, ConverterType ct):
	                     AbstractNode(pos)
	 {
		 m_featurename=name;
		 m_parameters=params;
		 m_type=ct;
	 }

     void  write(GraphStream * s);

	 void createConverter(ParentData * parent);
	 inline ~ConverterNode()
	 {
		 if (isOwningData())
		 {
			 delete m_featurename;
			 delete m_parameters;
		 }
	 }
};
